﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

using Padelcenter.Common;
using Padelcenter.DataAccess;

namespace Padelcenter.BusinessLogic.Insert
{
    public class InsertDomicilio : IBusinessLogic
    {
        public InsertDomicilio() { }

        public void Invoke()
        {
            Domicilio_Insert oDomicilioInsert = new Domicilio_Insert();
            oDomicilioInsert.Domicilio = this.Domicilio;
            this.Resultset = oDomicilioInsert.Get();
        }

        public void Add()
        {
            this.Invoke();
            int idInserted = 0;
            if (this.Resultset.Tables[0].Rows.Count > 0)
            {
                idInserted = Convert.ToInt32(this.Resultset.Tables[0].Rows[0][0]);
            }

            this.Domicilio.IdDomicilio = idInserted;
        }

        private DataSet _resultset;
        private Domicilio _domicilio;

        public Domicilio Domicilio
        {
            get { return _domicilio; }
            set { _domicilio = value; }
        }

        public DataSet Resultset
        {
            get { return _resultset; }
            set { _resultset = value; }
        }
    }
}
